<template>
	<view class="container">
		<view class="top">
			
		</view>
		<view class="main">
			<u-form-item label="支付宝账号" label-width="200"><u-input v-model="form.account"  placeholder="请输入支付宝账号"/></u-form-item>
			<u-form-item label="姓名" label-width="200"><u-input v-model="form.realName" placeholder="请输入姓名"/></u-form-item>
		</view>
		<view class="u-btn">
			<u-button style="color: #FFF; background-color: #1890ff; width: 90%; margin-top: 100rpx;" @click="banding">绑定账号</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form:{
					realName:"",
					account:"",
				}
			}
		},
		onLoad() {
			this.getAliIfo()
		},
		methods: {
			getAliIfo(){
				this.$u.api.getAlipay().then(res=>{
					if(res.code==1){
						this.form=res.data
					}
				})
			},
			banding(){
				if(!this.form.account){
					this.$u.toast("请输入支付宝账号")
					return
				}
				if(!this.form.realName){
					this.$u.toast("请输入姓名")
					return
				}
				this.$u.api.bandingAlipay(this.form).then(res=>{
					if(res.code == 1){
						this.$u.toast("绑定成功")
						setTimeout(()=>{
							this.$Router.back()
						},1000)
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.top{
		height: 10px;
	}
	.main{
		padding: 20px;
		background-color: #FFF;
	}
	.container{
		background: #f8f9f9;
		height: 95vh;
	}

</style>
